import java.util.Arrays;

public class Solution2187 {
    public long minimumTime(int[] time, int totalTrips) {
        long l= Arrays.stream(time).min().getAsInt(),r=totalTrips*10000000L;
        long ans=Long.MAX_VALUE;
        while (l<=r){
            long mid=(l+r)/2;
            long c=0;
            for (int i : time) {
                c=c+mid/i;
            }
            if (c<totalTrips){
                l=mid+1;
            }else{
                ans=mid;
                r=mid-1;
            }
        }
        return ans;
    }

    public static void main(String[] args) {
        System.out.println(new Solution2187().minimumTime(new int[]{1,2,3},5));
    }
}
